package feesmodule.domain;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="PROGRAM_SERVICE_MAP_INFO")
public class ProgramToSericeMapInfo implements Serializable
{

    @Embeddable
    public static class Id implements Serializable
    {
        @Column(name="PROGRAM_ID")
        private Long programId;
        @Column(name="SERVICE_ID")
        private Long serviceId;
        @Column(name ="DEBIT_INDICATOR")
        private Integer debitIndicator;

        public Id(){}
        public Id(Long serviceId, Long programId, Integer debitIndicator)
        {
            this.serviceId = serviceId;
            this.programId = programId;
            this.debitIndicator = debitIndicator;
        }
        @Override
        public boolean equals(Object ob)
        {
            if(ob instanceof Id)
            {
                return ((Id)ob).hashCode() == this.hashCode();
            }
            return false;
        }
        @Override
        public int hashCode()
        {
            return serviceId.hashCode() + programId.hashCode()+debitIndicator.hashCode();
        }
        
      }

    @EmbeddedId
    private Id id = new Id();
    @ManyToOne
    @JoinColumn(name="SERVICE_ID", insertable=false, updatable=false)
    private Service service;
    @ManyToOne
    @JoinColumn(name="PROGRAM_ID", insertable=false, updatable=false)
    private Program program;

    @Column(name="DEBIT_INDICATOR")
    private int debitIndicator;


    /**
     * @return the id
     */
    public Id getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Id id) {
        this.id = id;
    }

    /**
     * @return the service
     */
    public Service getService() {
        return service;
    }

    /**
     * @param service the service to set
     */
    public void setService(Service service) {
        this.service = service;
    }

    /**
     * @return the program
     */
    public Program getProgram() {
        return program;
    }

    /**
     * @param program the program to set
     */
    public void setProgram(Program program) {
        this.program = program;
    }

    /**
     * @return the debitIndicator
     */
    public int getDebitIndicator() {
        return debitIndicator;
    }

    /**
     * @param debitIndicator the debitIndicator to set
     */
    public void setDebitIndicator(int debitIndicator) {
        this.debitIndicator = debitIndicator;
    }
}
